import java.util.Scanner;


public class AnimalMain {
	
	private static Scanner input;

	public static void main(String[] args) {
		input = new Scanner(System.in);
		Master robert = new Master();
		
		// Adopt a pet
		robert.adopt(askWhichTypeToAdopt());
		
		// Give the name and age for the pet
		Adoptable pet = robert.getPet();
		giveNameAge(pet);
		
		// Adopt successfully!
		System.out.println("Congradulation! You just adopt a " + pet.getType() + "!");
		
		// Play with your pet
		pet.feed();
		pet.patForSleep();
		
		input.close();
	}

	private static Adoptable askWhichTypeToAdopt() {
		
		Adoptable pet = null;
		
		System.out.println("Which type of pets you want to adopt?");
		System.out.print("1.Dog  2.Cat  3.Hamster 4.Bonsai: ");
		int choice = input.nextInt();
		
		switch (choice)
		{
		case 1:
			pet = new Dog();
			break;
		case 2:
			pet = new Cat();
			break;
		case 3:
			pet =  new Hamster();
			break;
		case 4:
			pet = new Bonsai();
			break;
		default:
			pet = null;
			break;
		}
		
		return pet;
	}

	private static void giveNameAge(Adoptable pet) {
		System.out.print("Please enter the name for your pet: ");
		String name = input.next();
		
		System.out.print("Please enter the age of your pet: ");
		int age = input.nextInt();
		
		pet.setNameAge(name, age);
	}

}
